/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.K300;
import queenb.net.entitybean.M200;
import queenb.web.util.PackageContants;

/**
 *
 * @author DUYNGUYEN
 */
public class M200Store extends M200{
    
    public List<M200> getListM200All(int pnFH000, int pnFH200,int pnFK100, String pvLOGIN) {
        try {
            DataStatement data = new DataStatement(PackageContants.LIST_M200, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFK100),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(data, M200.class);
        } catch (SQLException ex) {
            Logger.getLogger(M200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(M200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(M200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    public int updateM200(int pnPM200,int pnFH000, int pnFH200,int pnFK100, String  pvMV201,String  pvMV202,String  pvMV203,String  pvMV204,int pnMN205,int pnMN206, String pdMD207,  String pvLOGIN) {
        DataStatement dataStetament = new DataStatement(PackageContants.UPDATE_M200, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnPM200),
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFK100),
                    new Param(OracleTypes.CHAR, pvMV201),
                    new Param(OracleTypes.CHAR, pvMV202),
                    new Param(OracleTypes.CHAR, pvMV203),
                    new Param(OracleTypes.CHAR, pvMV204),
                    new Param(OracleTypes.INTEGER, pnMN205),
                    new Param(OracleTypes.INTEGER, pnMN206),
                    new Param(OracleTypes.CHAR, pdMD207),
                    new Param(OracleTypes.CHAR, pvLOGIN)});
        try {
            return super.update(dataStetament, M200.class);
        } catch (SQLException ex) {
            Logger.getLogger(M200Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    public int deleteM200(int pnFH000,int pnFH200, int pnPM200, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.DELETE_M200, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnPM200),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.update(dataStatement, M200.class);
        } catch (SQLException ex) {
            Logger.getLogger(M200Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }

    }
}
